<template>
    <el-container style="height: 100vh;">
      <el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246);box-shadow: 2px 0 6px rgb(0 21 41 / 35%); overflow-x:hidden;">
        <Aside :isCollapse="isCollapse" :logoTextShow="logoTextShow"/>
      </el-aside>

      <el-container>
        <el-header style="border-bottom:1px solid #ccc;display: flex;text-align: right">
          <Header :collapseBtnClass="collapseBtnClass" :collapse="collapse" :squareUrl="squareUrl"/>
        </el-header>

        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue';
import Aside from "@/components/Aside.vue";
import Header from "../components/Header";

export default {
  name: 'Home',
  components: {
    Header,
    Aside
  },
  data() {
    const item = {
      date: '2016-05-02',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1518 弄'
    };
    return {
      tableData: Array(10).fill(item),
      collapseBtnClass:'el-icon-s-fold',
      squareUrl: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      isCollapse:false,
      sideWidth:200,
      logoTextShow:true,
    }
  },
  methods:{
    collapse(){ //点击收缩按钮触发
      this.isCollapse = !this.isCollapse;
        if(this.isCollapse){
          console.log("变小")
          this.sideWidth = 64;
          this.collapseBtnClass = 'el-icon-s-unfold';
          this.logoTextShow = false;
        }else{
          this.sideWidth = 200;
          this.collapseBtnClass = 'el-icon-s-fold';
          this.logoTextShow = true;
        }
    }
  }
}
</script>
